package com.yonyou.brigade.third_parties.fanscar.controller;

import com.yonyou.brigade.third_parties.fanscar.service.IFanscarUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 泛嘉商旅单点
 *
 * @author  kangfw5
 * @since 2019-03-06
 */
@Controller
@RequestMapping("/fanscar/sso")
public class FanscarSSOController {
    private final static Logger logger = LoggerFactory.getLogger(FanscarSSOController.class);

    @Autowired
    @Qualifier("fanscarUserServiceImpl")
    private IFanscarUserService fanscarUserService;

    @RequestMapping(path = "/login", method = RequestMethod.GET)
    public void login(String tenant, String org, String phone, String pageType, HttpServletResponse response) throws IOException {
        String loginUrl = fanscarUserService.getLoginUrl(tenant, org, phone, pageType, "H5", null);
        response.sendRedirect(loginUrl);
    }
}
